﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ContactCRUD.Classes
{
    public class EmailValidator : ValidationRule
    {
        public EmailValidator()
        {
            ValidationFaileure = string.Empty;
            ValidationScuccess = string.Empty;
        }
        public string ValidationFaileure
        {
            get;
            set;
        }
        public string ValidationScuccess
        {
            get;
            set;
        }
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            
            if (((string)value).Length > 0)
            {
                return new ValidationResult(false, ValidationFaileure);
            }
            // validate the email address   
            return new ValidationResult(true, ValidationScuccess);
        }
    }
}
